<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page trimDirectiveWhitespaces="true" %>
<fmt:setLocale value="zh_CN"/>
<style>
table.show td input[type="text"] {
    width: 90%;
}
</style>
<c:if test="${not empty list }">
<form action="${ctxPathA}/system/codegen/gen" method="post" id="codegenform" class="show-info">
	<table class="tab-show partshow">
		<col width="50">
		<col width="">
		<col width="">
		<col width="">
		<col width="98">
		<col width="">
		<col width="">
		<col width="95">
		<col width="85">
		<col width="95">
		<col width="130">
		<caption>model设置：表 ${tableName } 的字段</caption>
		 <tr>
	        <th colspan="7" style="color: red;text-align: center;">model设置</th>
	    	<th colspan="4" style="color: red;text-align: center;">JSP设置</th>
	    </tr>
	    <tr style="text-align: center;">
	        <th>序号</th>
	        <th>字段名</th>
	        <th style="color: red;">导出名称</th>
	        <th>数据库类型</th>
	        <th style="color: red;">导出类型</th>
	    	<th>注释</th>
	    	<th style="color: red;">显示名称（页面及注释中）</th>
	    	<th>搜索设置</th>
	    	<th>列表页显示</th>
	    	<th>input类型</th>
	    	<th>表单验证</th>
	    </tr>
	<c:forEach var="model" items="${list }" varStatus="var">
	    <tr>
	        <td style="text-align: center;">${(pageBean.currentPage -1)*pageBean.pageSize+var.count }</td>
	        <td title="${model.columnName }"><div class="ell">${model.columnName }<input type="hidden" name="columnName" value="${model.columnName }"/></div></td>
	        <td ><input type="text" name="fieldName" value="${model.exportColName }"/></td>
	        <td title="${model.columnType }"><div class="ell">${model.columnType }</div></td>
	        <td >
	        	<select name="fieldType" data-v="${model.javaDataType }" style="width:80px;">
	        		<option value="String">String</option>
	        		<option value="Integer">Integer</option>
	        		<option value="Long">Long</option>
	        		<option value="Double">Double</option>
	        		<option value="Float">Float</option>
	        		<option value="Date">Date</option>
	        		<option value="Boolean">Boolean</option>
	        		<option value="BigDecimal">BigDecimal</option>
	        		<option value="Long">Long</option>
	        		<option value="Set">Set</option>
	        		<option value="List">List</option>
	        		<option value="Map">Map</option>
	        	</select>
	        </td>
	        <td ><div class="ell">${model.remarks }</div></td>
	        <td ><input type="text" name="showName" value="${model.remarks }"/></td>
	        <td data-notitle="true">
				<!-- shieldCheckedRelated关联操作checkbox或radio元素，relatedTo为关联到的元素，relatedToType="disabled"表示将目标元素更改disabled属性（其他值：disabledAndHide及不写,默认只隐藏）-->
	        	<div class="block-i mb5"><input class="check shieldCheckedRelated"  relatedTo=".searchType_${model.columnName }" type="checkbox" name="cansearch-${model.columnName }" value="1" style="margin-right: 2px ;" />搜索</div>
	<c:set var="searchtypedefval" value="equal_"></c:set>
  	<c:if test="${model.javaDataType == 'Date' }">
  		<c:set var="searchtypedefval" value="date_"></c:set>
  	</c:if>
  	<c:if test="${model.columnName == 'text' }">
  		<c:set var="searchtypedefval" value="like_"></c:set>
  	</c:if>
	        	<select name="searchType" data-v="${searchtypedefval }" style="width:80px;" class="searchType_${model.columnName }">
	        		<option value="equal_">精确搜索</option>
	        		<option value="like_">模糊搜索("%xx%")</option>
	        		<option value="like1_">模糊搜索1("%xx")</option>
	        		<option value="like2_">模糊搜索2("xx%")</option>
	        		<option value="like4_">模糊搜索(带,号)</option>
	        		<option value="date_">日期起止</option>
	        		<option value="range_gt">大于</option>
	        		<option value="range_lt">小于</option>
	        		<option value="range_ge">大于等于</option>
	        		<option value="range_le">小于等于</option>
	        	</select>
	        </td>
	        <td class="taCenter" ><input class="check" type="checkbox" name="listshow-${model.columnName }" value="1"/>显示</td>
	        <!-- 不自动追加标题 -->
	        <td data-notitle="true">
  	<c:set var="inputdefval" value="text"></c:set>
  	<c:if test="${model.javaDataType == 'Date' }">
  		<c:set var="inputdefval" value="date"></c:set>
  	</c:if>
  	<c:if test="${model.columnName == 'text' }">
  		<c:set var="inputdefval" value="textarea"></c:set>
  	</c:if>
	        	<select name="inputType" data-v="${inputdefval }" style="width:80px;">
	        		<option value="text">input输入框</option>
	        		<option value="password">password输入框</option>
	        		<option value="date">日期框</option>
	        		<option value="textarea">textarea</option>
	        		<option value="editor">富文本编辑器</option>
	        		<option value="checkbox">复选框</option>
	        		<option value="radio">单选框</option>
	        		<option value="select">select下拉框</option>
	        		<option value="image">上传图片</option>
	        		<option value="file">上传附件</option>
	        	</select>
	        </td>
	        <td class="taCenter" >
				<div class="block-i"><input type="checkbox" class="check" name="formvalidate-${model.columnName }" value="required">必填</div>
				<div class="block-i"><input type="checkbox" class="check" name="formvalidate-${model.columnName }" value="mphone">手机号</div>
				<div class="block-i"><input type="checkbox" class="check" name="formvalidate-${model.columnName }" value="phone">电话</div>
				<div class="block-i"><input type="checkbox" class="check" name="formvalidate-${model.columnName }" value="email">Email</div>
			</td>
	    </tr>
	</c:forEach>
	</table>
	<table class="tab-show partshow" style="display: none;">
		<col width="150">
		<caption>导出配置</caption>
		<tr>
            <th>
                <label><font color="red">*</font>表名：</label>
            </th>
            <td ><input type="text" name="tableName" value="${tableName }" style="width: 20%;" readonly="readonly"/></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">*</font>类名：</label>
            </th>
            <td ><input type="text" name="className" value="${className }" style="width: 20%;"/><span class="red ml10">此名称为前缀，不包含Model，DAO，Conroller等，生成代码时会自动添加</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">*</font>作者：</label>
            </th>
            <td ><input type="text" name="author" value="${preference.author }" style="width: 20%;"/><span class="red ml10">用于类注释的作者【可在“个人设置”中设置】</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">&nbsp;</font>作者邮箱：</label>
            </th>
            <td ><input type="text" name="email" value="${preference.email }" style="width: 20%;"/><span class="red ml10">用于类注释的作者邮箱【可在“个人设置”中设置】</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">*</font>包名前缀：</label>
            </th>
            <td ><input type="text" name="packagePrefix" value="com.ld.admin" style="width: 20%;"/><span class="red ml10">如com.ld（不包含model，dao，conroller等，生成代码时会自动添加）</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">&nbsp;</font>包名后缀：</label>
            </th>
            <td ><input type="text" name="packageSuffix" value="" style="width: 20%;"/><span class="red ml10">如com.ld.model.system中的system</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">*</font>类说明：</label>
            </th>
            <td ><input type="text" name="modelComments" value="${tableComments == null ? '信息' : tableComments }" style="width: 20%;" maxlength="10"/><span class="red ml10">类的简要说明，尽量简短，用于model中的注释及方法注释</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">*</font>输出根目录：</label>
            </th>
            <td ><input type="text" name="outDir" value="${outdic }" style="width: 30%;"/>
			<!-- qtips提示，data-title设置标题【非必需】，data-cont设置内容【必需】，data-qtips-class设置样式【非必需】，data-qtips-class=yellow表示取内置的黄色样式【黄色、有阴影、圆角】，也可以写完整的样式qtip-yellow qtip-shadow qtip-rounded -->
			<img src="${ctxPath }/images/icon/question.png" class="qtips" data-title="" data-cont="远程访问时该设置无效。文件输出的根目录（输出的文件会再创建对应的子目录，）【可在“个人设置”中设置】" style="cursor: pointer;" data-qtips-class="yellow" >
			<span class="red ml10">文件输出的根目录（远程访问时该设置无效）【可在“个人设置”中设置】</span></td>
        </tr>
        
        <tr>
            <th>
                <label><font color="red">*</font>项目类型：</label>
            </th>
            <td >
            	<!-- shieldCheckedRelated为关联radio元素，relatedToType表示关联类型，relatedTo表示关联到的元素 -->
            	<input class="radio shieldCheckedRelated" type="radio" name="projectType" value="1" relatedTo=".projectType0"
            	data-java-main-dir="/src" data-jsp-main-dir="/WebRoot/WEB-INF/view"
            	/>普通<input 
            	class="radio shieldCheckedRelated" type="radio" name="projectType" value="0" checked="checked" relatedTo=".projectType0" 
            	data-java-main-dir="/src/main/java" data-jsp-main-dir="/src/main/webapp/WEB-INF/view" 
            	/>maven项目<input 
            	class="radio shieldCheckedRelated" type="radio" name="projectType" value="2" relatedTo=".projectType0"
            	data-java-main-dir="/src/main/java" data-jsp-main-dir="/src/main/resources/META-INF/resources/WEB-INF/view"
            	/>maven模块<input 
            	class="radio shieldCheckedRelated" type="radio" name="projectType" value="3" relatedTo=".projectType0"
            	data-java-main-dir="" data-jsp-main-dir=""
            	/>自定义<span class="red ml10">根据项目类型，输出的java目录及jsp目录会有所不同</span></td>
        </tr>
        <tr class="projectType0">
            <th>
                <label><font color="red">*</font>子目录：</label>
            </th>
            <td >
            	<table class="tab-show">
            		<tr><th style="width: 20%;">Java目录:</th><td><input type="input" name="javaMainDir" value="/src/main/java" /></td></tr>
            		<tr><th>Jsp目录:</th><td><input type="input" name="jspMainDir" value="/src/main/webapp/WEB-INF/view" /></td></tr></table>
            </td>
        </tr>
        
        
        <tr>
            <th>
                <label><font color="red">*</font>URL：</label>
            </th>
            <td ><input type="text" name="baseURL" value="${tableName }" style="width: 20%;"/><span class="red ml10">访问URL，不带search，show之类的具体路径，如：system/project</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">&nbsp;</font>JSP模块目录：</label>
            </th>
            <td ><input type="text" name="jspDir" value="" style="width: 20%;" maxlength="50"/><span class="red ml10">如a/system/project，jsp主目录下模块的目录，开头结尾不需要/</span></td>
        </tr>
        <tr>
            <th>
                <label><font color="red">&nbsp;</font>审核功能：</label>
            </th>
            <td ><input class="radio" type="radio" name="hasAudit" value="1" />包含<input class="radio" type="radio" name="hasAudit" value="0" checked="checked"/>不包含<span class="red ml10">jsp模板尚未制定</span></td>
        </tr>
           <tr>
            <th>
                <label><font color="red">&nbsp;</font>导入功能：</label>
            </th>
            <td ><input class="radio" type="radio" name="hasImport" value="1" />包含<input class="radio" type="radio" name="hasImport" value="0" checked="checked"/>不包含</td>
        </tr>
		<tr>
			<th>
				<label><font color="red">&nbsp;</font>选择版本：</label>
			</th>
			<td ><input class="radio" type="radio" name="templDir" value="" checked="checked" />新版<input class="radio" type="radio" name="templDir" value="old" />旧版</td>
		</tr>
        <tr>
            <th>
                <label><font color="red">*</font>导出选择：</label>
            </th>
            <td >
            	<!-- <input class="check" type="checkbox" name="outtype" value="0" checked="checked"/>Model
            	<input class="check" type="checkbox" name="outtype" value="1" />DAO -->
            	<!-- qtips提示，data-title设置标题【非必需】，data-cont设置内容【必需】，data-qtips-class设置样式【非必需】，data-qtips-class=yellow表示取内置的黄色样式【黄色、有阴影、圆角】，也可以写完整的样式qtip-yellow qtip-shadow qtip-rounded -->
            	<%-- <img src="${ctxPath }/images/icon/question.png" class="qtips" data-title="说明" data-cont="默认不生成" style="cursor: pointer;" data-qtips-class="yellow" >
            	<input class="check" type="checkbox" name="outtype" value="2" />Service --%>
            	<!-- qtips提示，data-title设置标题【非必需】，data-cont设置内容【必需】，data-qtips-class设置样式【非必需】，data-qtips-class=yellow表示取内置的黄色样式【黄色、有阴影、圆角】，也可以写完整的样式qtip-yellow qtip-shadow qtip-rounded  -->
            	<%-- <img src="${ctxPath }/images/icon/question.png" class="qtips" data-title="说明" data-cont="默认不生成，会使用父类的basicService，如果生成则service会使用新生成的对象" style="cursor: pointer;" data-qtips-class="qtip-yellow qtip-shadow qtip-rounded" >
            	<input class="check" type="checkbox" name="outtype" value="3" checked="checked"/>JSP
            	<input class="check" type="checkbox" name="outtype" value="4" checked="checked"/>Controller --%>
            	<table class="tab-show">
            		<tr>
            			<th style="width: 20%;">类型</th>
            			<th style="text-align: center;">模板</th>
            		</tr>
            		<tr>
            			<th>Model:<input class="check" type="checkbox" name="outtype" value="0" checked="checked"/></th>
            			<td><input type="input" name="modelTempl" value="model.html" /></td>
            		</tr>
            		<tr>
            			<th>DAO:<input class="check" type="checkbox" name="outtype" value="1" />
            			<!-- qtips提示，data-title设置标题【非必需】，data-cont设置内容【必需】，data-qtips-class设置样式【非必需】，data-qtips-class=yellow表示取内置的黄色样式【黄色、有阴影、圆角】，也可以写完整的样式qtip-yellow qtip-shadow qtip-rounded -->
            			<img src="${ctxPath }/images/icon/question.png" class="qtips" data-title="说明" data-cont="默认不生成" style="cursor: pointer;" data-qtips-class="yellow" ></th>
            			<td><input type="input" name="daoTempl" value="dao.html" /></td></tr>
            		<tr>
            			<th>Service:<input class="check" type="checkbox" name="outtype" value="2" />
            			<!-- qtips提示，data-title设置标题【非必需】，data-cont设置内容【必需】，data-qtips-class设置样式【非必需】，data-qtips-class=yellow表示取内置的黄色样式【黄色、有阴影、圆角】，也可以写完整的样式qtip-yellow qtip-shadow qtip-rounded  -->
            			<img src="${ctxPath }/images/icon/question.png" class="qtips" data-title="说明" data-cont="默认不生成，会使用父类的basicService，如果生成则service会使用新生成的对象" style="cursor: pointer;" data-qtips-class="qtip-yellow qtip-shadow qtip-rounded" ></th>
            			<td><input type="input" name="serviceTempl" value="service.html" /></td></tr>
            		<tr>
            			<th>Controller:<input class="check" type="checkbox" name="outtype" value="4" checked="checked"/></th>
            			<td><input type="input" name="controllerTempl" value="controller.html" /></td></tr>
            		<tr>
            			<th>JSP:<input class="check" type="checkbox" name="outtype" value="3" checked="checked"/></th>
            			<td><input type="input" name="jspTempl" value="search.html,list.html,show.html,update.html" />
            			<span class="red ml10">模板需要放到模板根路径的jsp子目录下，写相对jsp目录的相对路径，用逗号分隔多个模块。</span></td></tr></table>
            </td>
        </tr>
    </table>
	<div style="margin-top:10px;display: none;" align="center" class="partshow">
		<!-- disabledBtn方法将button置为不可用影响了click方法的执行，所以button外包一层span -->
		<span class=""><input type="button" class="shieldA button cg_previewBtn" shieldParams="{preview:1}" paramSelector="#codegenform" data-method="post"
			data-url="${ctxPathA}/system/codegen/preview" value="预览" data-target="#cg_previewDiv"/></span>
	</div>
	<div style="margin-top:10px;display: none;" align="center" class="partshow">
		<input class="button" type="submit" value="生成"/>
	</div>
</form>
</c:if>
<c:if test="${empty list }">
<table>
    <!-- 无数据时展示，有数据时展示上面的列表 -->
    <tr>
        <td colspan="8" class="taCenter">没有表字段信息！</td>
    </tr>
</table>
</c:if>
<script type="text/javascript">
	/* 点击预览按钮，触发回调方法cg_previewBtnclickCallback，该方法再search页面，事件是点击页面的第四步 */
	$(".cg_previewBtn").unbind("clickCallback").bind("clickCallback", function(){cg_previewBtnclickCallback();});
</script>
